package com.hnl.core;

import java.util.HashMap;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;

import com.hnl.util.XMLConfigUtil;

public class AttachmentConfig {
	static final Logger LOG = LoggerFactory.getLogger(AttachmentConfig.class);

	public static String tomcatPath;
	public static String contextPath;
	public static String urlPath;

	public void readAttachmentSourcesFromXml(Element e) {
		List<Element> n = XMLConfigUtil.getChildNodes(e,
				HNLConfig.ATTACHMENT_LOCATION);
		if (!n.isEmpty()) {
			for (Element element : n) {
				HashMap<String, String> attrs = XMLConfigUtil
						.getAllAttributes(element);
				tomcatPath = attrs.get("webAppPath");
				contextPath = attrs.get("contextPath");
				urlPath = attrs.get("downloadPath");
			}
		}
	}

}
